import { CategoryItem } from '../types/category'
import { http } from '@/utils/http'

/**
 *  查询一级分类列表和二级分类列表
 * @returns 一级分类列表和二级分类列表
 */
export const listOneTwoCategoryAPI = () => {
	return http<CategoryItem[]>({
		url: '/fanqie/categories/listOneTwoCategory',
		method: 'GET',
	})
}

/**
 *  查询一级分类列表和二级分类列表
 * @param categoryId 一级分类id
 * @returns 一级分类列表和二级分类列表
 */
export const listTwoThreeCategoryAPI = (categoryId : number) => {
	return http<CategoryItem[]>({
		url: '/fanqie/categories/listTwoThreeCategory',
		method: 'GET',
		data: { categoryId: categoryId }
	})
}

/**
 * 查询三级分类
 */
export const listThreeCategoryAPI = (parentId : number) => {
	return http<CategoryItem[]>({
		url: '/fanqie/categories/listThreeCategory',
		method: 'GET',
		data: { parentId: parentId }
	})
}